﻿@{
    ViewBag.Title = "医保病人信息";
    Layout = "~/Views/Shared/_Index.cshtml";
}
@{
    //是否和新农合交易
    var openXnhSett = SysConfigReader.Bool("Inpatient_Sett_OpenXnhSett");
    //是否和医保交易
    var openYbSett = SysConfigReader.Bool("Outpatient_ChargeFee_OpenYbSett");
    //医保患者必须一次结掉
    bool? ybSettOnce = (openYbSett ?? false) && (SysConfigReader.Bool("Outpatient_ChargeFee_yb_SettOnce") ?? false);
    var opr = Newtouch.Common.Operator.OperatorProvider.GetCurrent();
    //医保所属地
    var medicalInsurance = SysConfigReader.String("Outpatient_MedicalInsurance");
}
<style type="text/css">
    .form .formTitleTh {
        position: relative;
        left: 0px;
        text-align: right;
        white-space: nowrap;
        font-weight: normal;
        width: 120px;
        padding-right: 0px;
    }
    .form .formTitleAccount {
        position: relative;
        left: 0px;
        text-align: right;
        white-space: nowrap;
        font-weight: normal;
        width: 200px;
        padding-right: 0px;
    }
    .form .formValueYb {
        position: relative;
        width: auto;
        padding: 5px;
        text-align:left;
    }
</style>
<div class="panel panel-default" style="margin-bottom: 4px;">
    <div class="panel-heading navb-bg">
        筛选条件
    </div>

    <div style="padding-right:20px;">
        <table class="form">
            <tr>
                <th class="formTitle">社保卡号：</th>
                <td class="formValue" style="width:150px">
                    <input type="text" class="form-control" style="width:150px" id="sbkhId" placeholder="输入社保卡号" />
                </td>
                <td class="formTitle" style="width:50px">
                    <input type="button" class="btn btn-default btn-md btn-default-color" id="btkhsr" value="查询" onclick="GetReadCardInfo($('#sbkhId').val(),true);" />
                </td>
                <td class="formValue">
                    @if (openYbSett == true || openXnhSett == true)
                    {
                        <div id="readCard" style="color:orangered;display:initial;">
                            <i class="fa fa-id-card" style="font-size: 27px; float: left;vertical-align:central;" title="读卡"></i>
                            <select id="readCardCardType" class="form-control" style="margin-left: 0px;margin-top: 2px; height: 22px;width:36px;float: left;vertical-align:central;">
                                @if (openYbSett == true)
                                {
                                    <option value="04">社</option>
                                }
                                <option value="07">社(电)</option>
                                @if (openXnhSett == true && medicalInsurance != "chongqing")
                                {
                                    <option value="06">农</option>
                                }
                                <option value="03">身</option>
                                @if (medicalInsurance != "guian" && medicalInsurance != "chongqing")
                                {
                                    <option value="05">市</option>
                                }
                            </select>
                        </div>
                    }
                </td>
            </tr>
        </table>

    </div>
</div>
<div class="panel panel-default" style="margin-bottom: 4px;">
    <div class="panel-heading navb-bg">
        基本信息
    </div>
    <div style="padding-right:0px; text-align:center">
        <table class="form">
            <tr>
                <th class="formTitleTh">卡号：</th>
                <td class="formValueYb" style="width: 120px;">
                    <label id="kh"></label>
                </td>
                <th class="formTitleTh">姓名：</th>
                <td class="formValueYb" style="width: 120px;">
                    <label id="xm"></label>
                </td>
                <td class="formTitleTh">性别：</td>
                <td class="formValueYb">
                    <label id="xb"></label>
                </td>
                <td class="formTitleTh">年龄：</td>
                <td class="formValueYb">
                    <label id="nl"></label>
                </td>
                <th class="formTitleTh">身份证号：</th>
                <td class="formValueYb">
                    <label id="sfz"></label>
                </td>
               
            </tr>
            <tr>
                <th class="formTitleTh">民族：</th>
                <td class="formValueYb">
                    <label id="mz"></label>
                </td>
                <th class="formTitleTh">住址：</th>
                <td class="formValueYb">
                    <label id="dz"></label>
                </td>
                <td class="formTitleTh">人员类别：</td>
                <td class="formValueYb">
                    <label id="rylb"></label>
                </td>
                <td class="formTitleTh">是否享受公务员待遇：</td>
                <td class="formValueYb">
                    <label id="sfxsgwydy"></label>
                </td>
                <td class="formTitleTh">单位名称：</td>
                <td class="formValueYb">
                    <label id="dwmc"></label>
                </td>
               

            </tr>
            <tr>
                <td class="formTitleTh">行政区划编码：</td>
                <td class="formValueYb">
                    <label id="xzqhbm"></label>
                </td>
                <td class="formTitleTh">封锁状况：</td>
                <td class="formValueYb">
                    <label id="fszk"></label>
                </td>
                <td class="formTitleTh">封锁原因：</td>
                <td class="formValue">
                    <label id="fsyy"></label>
                </td>
                <th class="formTitleTh">人员变更类型：</th>
                <td class="formValueYb">
                    <label id="rybglx"></label>
                </td>
                <td class="formTitleTh">人员类型变更时间：</td>
                <td class="formValueYb">
                    <label id="rylxbgDate"></label>
                </td>
               

            </tr>
            <tr>
                <td class="formTitleTh">待遇封锁开始时间：</td>
                <td class="formValueYb">
                    <label id="dyfsStarDate"></label>
                </td>
                <td class="formTitleTh">待遇封锁终止时间：</td>
                <td class="formValueYb">
                    <label id="dyfsEndDate"></label>
                </td>
                <td class="formTitleTh">民政人员类别：</td>
                <td class="formValueYb">
                    <label id="mzrylb"></label>
                </td>
                <td class="formTitleTh">居民缴费档次：</td>
                <td class="formValueYb">
                    <label id="jmjfdc"></label>
                </td>
                <th class="formTitleTh">参保类别：</th>
                <td class="formValueYb">
                    <label id="cblb"></label>
                </td>
                

            </tr>
            <tr>
                <td class="formTitleTh">患者联系电话：</td>
                <td class="formValueYb">
                    <label id="lxdh"></label>
                </td>
                <td class="formTitleTh">是否健康扶贫人员：</td>
                <td class="formValueYb">
                    <label id="sfjkfpry"></label>
                </td>
            </tr>
        </table>
    </div>
</div>
<div class="panel panel-default" style="margin-bottom: 4px;">
    <div class="panel-heading navb-bg">
        账户信息
    </div>
    <div style="padding-right:20px;">
        <table class="form">
            <tr>
                <th class="formTitleAccount">帐户余额：</th>
                <td class="formValueYb">
                    <label id="zhye"></label>
                </td>
                <td class="formTitleAccount">本年统筹支付累积：</td>
                <td class="formValueYb">
                    <label id="tczflj"></label>
                </td>
                <td class="formTitleAccount">本年特殊门诊起付标准支付累计：</td>
                <td class="formValueYb">
                    <label id="tbmzzflj"></label>
                </td>
                <th class="formTitleAccount">本年特殊门诊医保费累计：</th>
                <td class="formValueYb">
                    <label id="tbmzybflj"></label>
                </td>
            </tr>
            <tr>
                <th class="formTitleAccount">本年恶性肿瘤住院起付标准支付累计：</th>
                <td class="formValueYb">
                    <label id="exzlzflx"></label>
                </td>
                <td class="formTitleAccount">本年符合公务员范围门诊费用累计：</td>
                <td class="formValueYb">
                    <label id="gwyfylj"></label>
                </td>
                <td class="formTitleAccount">本年住院次数：</td>
                <td class="formValueYb">
                    <label id="zycs"></label>
                </td>
                <td class="formTitleAccount">住院状态：</td>
                <td class="formValueYb">
                    <label id="zyzt"></label>
                </td>

            </tr>
            <tr>
                <th class="formTitleAccount">本年特病门诊还需补助的自付金额：</th>
                <td class="formValueYb">
                    <label id="tbzfje"></label>
                </td>
                <td class="formTitleAccount">本年住院还需补助的自付金额：</td>
                <td class="formValueYb">
                    <label id="zyzfje"></label>
                </td>
                <td class="formTitleAccount">本年发生过恶性肿瘤标志：</td>
                <td class="formValueYb">
                    <label id="exzlbz"></label>
                </td>
                <td class="formTitleAccount">本年大病支付累计：</td>
                <td class="formValueYb">
                    <label id="dbzflj"></label>
                </td>

            </tr>
            <tr>
                <th class="formTitleAccount">居保重大疾病发生标志：</th>
                <td class="formValueYb">
                    <label id="dbbz"></label>
                </td>
                <td class="formTitleAccount">本年意外伤害支付累计：</td>
                <td class="formValueYb">
                    <label id="ywshzflj"></label>
                </td>
                <td class="formTitleAccount">本年耐多药结核支付累计：</td>
                <td class="formValueYb">
                    <label id="ndyjhzflj"></label>
                </td>
                <td class="formTitleAccount">本年儿童两病支付累计：</td>
                <td class="formValueYb">
                    <label id="etlbzflj"></label>
                </td>

            </tr>
            <tr>
                <th class="formTitleAccount">本年康复项目支付累计：</th>
                <td class="formValueYb">
                    <label id="khxmzflj"></label>
                </td>
                <td class="formTitleAccount">年度民政住院支付累计：</td>
                <td class="formValueYb">
                    <label id="mzzyzfje"></label>
                </td>
                <td class="formTitleAccount">年度民政门诊支付累计：</td>
                <td class="formValueYb">
                    <label id="mzmzzfje"></label>
                </td>
                <td class="formTitleAccount">降消补助累计：</td>
                <td class="formValueYb">
                    <label id="jxbzje"></label>
                </td>

            </tr>
            <tr>
                <th class="formTitleAccount">年度普通门诊统筹累计：</th>
                <td class="formValueYb">
                    <label id="mztcljje"></label>
                </td>
                <td class="formTitleAccount">异地登记标识：</td>
                <td class="formValueYb">
                    <label id="yddjbs"></label>
                </td>
                <td class="formTitleAccount">账户信息预留 1：</td>
                <td class="formValueYb">
                    <label id="zhxxyl1"></label>
                </td>
                <td class="formTitleAccount">账户信息预留 2：</td>
                <td class="formValueYb">
                    <label id="zhxxyl2"></label>
                </td>

            </tr>
        </table>
    </div>
</div>
<div class="panel panel-default" style="margin-bottom: 4px;">
    <div class="panel-heading navb-bg">
        医保特病审批信息
    </div>
    <div style="padding-right: 20px;">
        <table class="form">
            <tr>
                <th class="formTitle">特病信息：</th>
                <td class="formValue">
                    <label id="tbinfo"></label>
                </td>
            </tr>
        </table>
    </div>
</div>
<div class="panel panel-default" style="margin-bottom: 4px;">
    <div class="panel-heading navb-bg">
        新老卡卡号信息
    </div>
    <div style="padding-right: 20px;">
        <table class="form">
            <tr>
                <th class="formTitle">医保卡号：</th>
                <td class="formValue">
                    <label id="ybkhInfo"></label>
                </td>
                <th class="formTitle">社保卡号：</th>
                <td class="formValue">
                    <label id="sbkhInfo"></label>
                </td>
                <td class="formTitle"></td>
                <td class="formValue"></td>
                <td class="formTitle"></td>
                <td class="formValue"></td>
            </tr>
        </table>
    </div>
</div>
<div class="panel panel-default" style="margin-bottom: 4px;">
    <div class="panel-heading navb-bg">
        特病处方查询
    </div>
    <div style="padding-right: 20px;">
        <table class="form">
            <tr>
                <th class="formTitle">特病病种编码：</th>
                <td class="formValue" >
                    <select id="tbbzbm" name="tbbzbm" class="form-control" style="width:100px">
                        @*<option value="1">==请选择==</option>*@
                    </select>
                </td>
            </tr>
            <tr>
                <th class="formTitle">特病处方信息：</th>
                <td class="formValue">
                    <label id="tbcfInfo"></label>
                </td>
            </tr>
        </table>
    </div>
</div>

<script type="text/javascript">
    var openYbSett = '@openYbSett' === 'True'; //开关配置：医保患者是否使用医保交易流程
    var ybSettOnce = '@ybSettOnce' === 'True'; //开关配置：医保患者是否一次结
    var medicalInsurance = '@medicalInsurance';//医保所属地配置:区分医院所属医保区域
    //读卡
    function readCard() {
        var cardInfo;
        var yibaoCardInfo;
        var cqcardInfo;
        var cqyibaoCardInfo;
        if (medicalInsurance === "changshu") {
            yibaoCardInfo = $.yibao.GetCardInfo($('#readCardCardType').val()); //医保读卡，返回卡身份信息
            $.loading(false);
            if (yibaoCardInfo && yibaoCardInfo.Code === 0) {
                cardInfo = yibaoCardInfo.Data;
                yibaoCardInfo.readCardCardType = $('#readCardCardType').val();
                localStorage.setItem("patientform", JSON.stringify(yibaoCardInfo));
                //卡读到了
                //卡号 卡类型    //社保编号 暂作为系统卡号
                GetQueryFphAjax({ blh: null, kh: cardInfo.DAC001, zjh: null, cardType: ybkCardType }, function () {
                    if (patModel) {
                        //患者性质对照赋值 默认用最新的费用性质 还要给patModel.brxz patModel.brxzmc
                        var ybfyxzCompResult = $.CataComparison.getItemByTT('yibao', 'AKE556', cardInfo.AKE556);
                        if (!ybfyxzCompResult.Name) {
                            $.modalAlert("费用性质.对照目录映射失败", 'error');
                            return;
                        }
                        patModel.brxz = ybfyxzCompResult.Code;
                        patModel.brxzmc = ybfyxzCompResult.Name;
                        $("#brxzmc").attr("data-brxzmc", ybfyxzCompResult.Name)
                            .attr("data-brxz", ybfyxzCompResult.Code);
                        $("#brxzmc").val(ybfyxzCompResult.Name);
                    }
                });
            }
            else {
                $.modalAlert(yibaoCardInfo.ErrorMsg, 'error');
                return;
            }
        }
        else if (medicalInsurance === "guian") { //贵安医保
            if ($('#readCardCardType').val() === "04") {
                //= $.guianyibao.Identification(); //医保读卡，返回卡身份信息
                var payoptype = { "prm_payoptype": "04" };
                $.ajax({
                    url: "http://127.0.0.1:12345/api/YiBao/Identification",
                    data: payoptype,
                    dataType: "json",
                    async: false,
                    success: function (data) {
                        yibaoCardInfo = eval('(' + data + ')');
                    }
                });
                $.loading(false);
                if (yibaoCardInfo) {
                    if (yibaoCardInfo.Code === 0) {
                        cardInfo = yibaoCardInfo.Data; //医保反馈对象
                        if (cardInfo.prm_ykc023 === "1") {
                            $.modalAlert("当前处于在院状态，不允许门诊刷卡", 'error');
                            return;
                        }
                        yibaoCardInfo.readCardCardType = $('#readCardCardType').val();
                        yibaoCardInfo.kh = cardInfo.prm_aac001;
                        localStorage.setItem("patientform", JSON.stringify(yibaoCardInfo));
                        GetQueryFphAjax({ blh: null, kh: cardInfo.prm_aac001, zjh: null, cardType: ybkCardType },
                            function () {
                                if (patModel) {
                                    //患者性质对照赋值 默认用最新的费用性质 还要给patModel.brxz patModel.brxzmc
                                    var ybfyxzCompResult = {
                                        Code: '1',
                                        Name: '普通医保'
                                    };
                                    //$.CataComparison.getItem('yibao', 'xt_brxz', "1"); //固定为医保,只有医保刷卡(1,医保)
                                    if (!ybfyxzCompResult.Name) {
                                        $.modalAlert("费用性质.对照目录映射失败", 'error');
                                        return;
                                    }
                                    patModel.brxz = ybfyxzCompResult.Code;
                                    patModel.brxzmc = ybfyxzCompResult.Name;
                                    $("#brxzmc").attr("data-brxzmc", ybfyxzCompResult.Name)
                                        .attr("data-brxz", ybfyxzCompResult.Code);
                                    $("#brxzmc").val(ybfyxzCompResult.Name);
                                }
                            });
                        $("#txtybye").html(cardInfo.prm_akc087);
                    } else {
                        $.modalAlert("刷卡失败:" + yibaoCardInfo.ErrorMsg, 'error');
                    }
                } else {
                    $.modalAlert("刷卡获取医保信息失败！失败原因：医保中心无信息返回，请重试！", 'error');
                }
            } else if ($('#readCardCardType').val() === "03") {
                try {
                    //= $.guianyibao.ReadIdCard(); //身份证读卡，返回卡身份信息
                    $.ajax({
                        url: "http://127.0.0.1:12345/api/YiBao/ReadIdCard",
                        data: {},
                        dataType: "json",
                        async: false,
                        success: function (data) {
                            cardInfo = eval('(' + data + ')');
                        }
                    });
                    $.loading(false);
                    if (cardInfo) {
                        if (cardInfo.Code === 0) {
                            cardInfo.readCardCardType = $('#readCardCardType').val();
                            GetQueryFphAjax({ blh: null, kh: null, zjh: cardInfo.cardId, cardType: xnkCardType },
                                function () {
                                    if (patModel) {
                                        patModel.brxz = "0";
                                        patModel.brxzmc = "自费";
                                        $("#brxzmc").attr("data-brxzmc", "自费")
                                            .attr("data-brxz", "0");
                                        $("#brxzmc").val("自费");
                                    }
                                });
                        } else {
                            $.modalAlert("刷身份证卡失败：" + cardInfo.ErrorMsg, 'error');
                        }
                    } else {
                        $.modalAlert("刷身份证卡获取信息失败", 'error');
                    }
                } catch (err) {
                    $.modalAlert("刷身份证卡失败失败，请重新操作" + err, 'error');
                }
            } else if ($('#readCardCardType').val() === "06") {
                //新农合
                $.loading(false);
                $.modalOpen({
                    id: "Form",
                    title: "家庭参保参数输入",
                    url: "/PatientManage/HospiterRes/XNHfamilyrequestParForm",
                    width: "450px",
                    height: "224px",
                    callBack: function (iframeId) {
                        top.frames[iframeId].submitForm(function (jrespdata) {
                            if (!!jrespdata && jrespdata.length > 0) {
                                jrespdata.readCardCardType = $('#readCardCardType').val();
                                localStorage.setItem("jrespdata", JSON.stringify(jrespdata));
                                $.modalOpen({
                                    id: "XNHParticipantsList",
                                    title: "家庭参保人列表",
                                    url: "/PatientManage/HospiterRes/XNHParticipantsList",
                                    width: "850px",
                                    height: "424px"
                                });
                            }
                        });
                    }
                });
            }
        }
        else if (medicalInsurance === "chongqing") {
            if ($('#readCardCardType').val() === "04" || $('#readCardCardType').val() === "07") {
                //= $.guianyibao.Identification(); //医保读卡，返回卡身份信息
                GetReadCardInfo(null,false);
            }
        }
        else {
            $.modalAlert("医保所属地未设置，请设置后再进行刷卡", 'warning');
            return;
        }
    }
    //读卡 调用01,13接口
    function GetReadCardInfo(sbkobj, boolVal) {
        if (!sbkobj && boolVal==true) {
            $.modalAlert("请输入社保卡", 'error');
            return;
        }

        var cardInfo;
        var yibaoCardInfo;
        var cqcardInfo;
        var cqyibaoCardInfo;
        var patsbkh = null;
        if (sbkobj) {
            patsbkh = sbkobj;
        }
        if (!patsbkh) {
            var rzfsInfo = { "rzfs": $('#readCardCardType').val() == "04" ? "01" : "02" };
            $.ajax({
                type: "POST",
                url: "http://127.0.0.1:22222/api/CQYiBao/ReadCard",
                dataType: "json",
                data: rzfsInfo,
                async: false,
                success: function (data) {
                    cqyibaoCardInfo = eval('(' + data + ')');
                }
            });
        }
        else {
            cqyibaoCardInfo = { "Code": "1", "Data": { "sbkh": patsbkh } };
        }

        if (cqyibaoCardInfo) {
            $.loading(false);
            if (cqyibaoCardInfo.Code === "1") {
                cqcardInfo = cqyibaoCardInfo.Data; //医保反馈对象
                if (!cqcardInfo.sbkh) {
                    $.modalAlert("读卡失败：未获取到社保卡卡号", 'error');
                    return;
                }

                var payoptype = { "sbkh": cqcardInfo.sbkh, "xzlb": "1" };//险种类别默认，1、医疗保险；2、工伤保险；3、生育保险；
                $.ajax({
                    type: "POST",
                    url: "http://127.0.0.1:22222/api/CQYiBao/PatAccountInfo",
                    dataType: "json",
                    data: payoptype,
                    async: false,
                    success: function (data) {
                        yibaoCardInfo = eval('(' + data + ')');
                    }
                });
                if (yibaoCardInfo) {
                    if (yibaoCardInfo.Code === "1") {
                        if (!yibaoCardInfo.Data || !yibaoCardInfo.Data.patInfo || !yibaoCardInfo.Data.accountInfo) {
                            $.modalAlert("调用医保接口01和13，获取获取人员和账户信息失败！", 'error');
                            return;
                        }
                        cardInfo = yibaoCardInfo.Data.patInfo; //医保反馈对象

                        if (!!cardInfo.fsyy) {
                            $.modalAlert("该卡已经封锁：" + cardInfo.fsyy, 'error');
                            return;
                        }
                        yibaoCardInfo.readCardCardType = $('#readCardCardType').val();
                        yibaoCardInfo.kh = cqcardInfo.sbkh;
                        localStorage.setItem("patientform", JSON.stringify(yibaoCardInfo));
                        //赋值
                        SetValue(cardInfo, yibaoCardInfo.Data.accountInfo);
                        $("#kh").html(cqcardInfo.sbkh);
                        //$("#txtybye").html(yibaoCardInfo.Data.accountInfo.zhye); /////191108 卡余额，是否读卡时关联返回卡信息，金保卡和社保卡区别？？？

                        var param = "07|" + cqcardInfo.sbkh;
                        var payoptype = { "inStr": param };//险种类别默认，1、医疗保险；2、工伤保险；3、生育保险；
                        $.ajax({
                            type: "POST",
                            url: "http://127.0.0.1:22222/api/CQYiBao/BusinessCall",
                            dataType: "json",
                            data: payoptype,
                            async: false,
                            success: function (data) {
                                $("#tbinfo").html(data);
                                if (data != "1|##")
                                {
                                    $("#tbbzbm").empty();
                                    var arr = new Array();
                                    arr = data.substring(2).split("$");
                                    for (var i = 0; i <= arr.length - 1; i++) {
                                        var op = new Array();
                                        var val = arr[i];
                                        op = val.split("|");
                                        arr[i] = op[0];
                                    }
                                    var o =  document.getElementById("tbbzbm");
                                    var len = arr.length;
                                    for (var j = 0; j < len; j++) {
                                        var op = document.createElement("option");
                                        op.setAttribute("value", arr[j]);
                                        op.innerHTML = arr[j];
                                        o.appendChild(op);
                                    }
                                    $("#tbbzbm").trigger("change");
                                }
                                
                            }
                        });
                        $.ajax({
                            type: "POST",
                            url: "http://127.0.0.1:22222/api/CQYiBao/GetNewOldCard",
                            dataType: "json",
                            data: payoptype,
                            async: false,
                            success: function (data) {
                                var newoldkh = eval('(' + data + ')');
                                if (newoldkh)
                                {
                                    if (newoldkh.Code === "1" && !!newoldkh.Data) {
                                        $("#ybkhInfo").html(newoldkh.Data.ybkh);
                                        $("#sbkhInfo").html(newoldkh.Data.sbkh);
                                    }
                                }
                                
                            }
                        });

                        //$.ajax({
                        //    type: "POST",
                        //    url: "http://127.0.0.1:22222/api/CQYiBao/GetYbTbExaminationInfo",
                        //    dataType: "json",
                        //    data: { "sbkh": patsbkh },
                        //    async: false,
                        //    success: function (data) {
                        //        var TbMzReg = eval('(' + data + ')');
                        //        if (TbMzReg) {
                        //            if (TbMzReg.Code === "1" && !!TbMzReg.Data) {
                        //                
                        //                $("#tbinfo").html(data);
                                      
                        //            }
                             
                        //        }
                        //    }
                        //});


                    } else {
                        $.modalAlert("刷卡失败:" + yibaoCardInfo.ErrorMsg, 'error');
                    }
                } else {
                    $.modalAlert("刷卡获取医保信息失败！失败原因：医保中心无信息返回，请重试！", 'error');
                }
            }
            else {
                $.modalAlert("读卡失败:" + cqyibaoCardInfo.ErrorMsg, 'error');
            }
        }



    }

    $('#readCard i').click(function () {
        setTimeoutReadCard();
    });


    $("#tbbzbm").change(function () {
        var param = "28|" + $('#kh').html() + "|" + $('#tbbzbm').val();
        var payoptype = { "inStr": param };//险种类别默认，1、医疗保险；2、工伤保险；3、生育保险；
        $.ajax({
            type: "POST",
            url: "http://127.0.0.1:22222/api/CQYiBao/BusinessCall",
            dataType: "json",
            data: payoptype,
            async: false,
            success: function (data) {
                $("#tbcfInfo").html(data);
            }
        });
    })

    //触发读卡
    function setTimeoutReadCard() {
        $.loading(true, '正在读卡，请稍后…');
        setTimeout("readCard();", 50);
    }

    function SetValue(patInfo,AccountInfo)
    {

        $("#xm").html(patInfo.xm);
        $("#xb").html(patInfo.xb);
        $("#nl").html(patInfo.sznl+'岁');
        $("#sfz").html(patInfo.sfzh);
        $("#mz").html(patInfo.mz);
        $("#dz").html(patInfo.zz);
        $("#rylb").html(patInfo.rylb == "11" ? "在职" : (patInfo.rylb == "21" ?"退休":(patInfo.rylb=="41" ? "成年人":(patInfo.rylb=="42" ? "未成年人":(patInfo.rylb=="43"?"大学生": patInfo.rylb)))));
        $("#sfxsgwydy").html(patInfo.sfxsgwydy == "0" ? "不享受" : (patInfo.sfxsgwydy =="1"? "享受" :"不享受"));
        $("#dwmc").html(patInfo.dwmc);
        $("#xzqhbm").html(patInfo.xzqybm);
        $("#fszk").html(fszk(patInfo.fszk));
        $("#fsyy").html(patInfo.fsyy);
        $("#rybglx").html(rybglx(patInfo.rybglx));
        $("#rylxbgDate").html(patInfo.rylxbgsj);
        $("#dyfsStarDate").html(patInfo.dyfskssj);
        $("#dyfsEndDate").html(patInfo.dyfszzsj);
        $("#mzrylb").html(mzrylb(patInfo.mzrylb));
        $("#jmjfdc").html(patInfo.jfdc=="1"?"一档":(patInfo.jfdc=="2" ? "二档":patInfo.jfdc));
        $("#cblb").html(patInfo.cblb=="1"?"职工参保":(patInfo.cblb=="2"?"居民参保":(patInfo.cblb=="3"?"离休干部":patInfo.cblb)));
        $("#lxdh").html(patInfo.lxdh);
        $("#sfjkfpry").html(patInfo.dqsfjkfp=="0"?"否":"是");

        $("#zhye").html('¥' + AccountInfo.zhye);
        $("#tczflj").html('¥' + AccountInfo.bntczflj);
        $("#tbmzzflj").html('¥' + AccountInfo.tsmzqflj);
        $("#tbmzybflj").html('¥' + AccountInfo.tsmzybflj);
        $("#exzlzflx").html('¥' + AccountInfo.zlzyqflj);
        $("#gwyfylj").html('¥' + AccountInfo.gwymzlj);
        $("#zycs").html(AccountInfo.zylj);
        $("#zyzt").html(AccountInfo.zyzt=="0"?"未住院":"在住院");
        $("#tbzfje").html('¥' + AccountInfo.tsmzxbzje);
        $("#zyzfje").html('¥' + AccountInfo.zyxbzje);
        $("#exzlbz").html(AccountInfo.fsexzlbz=="0"?"未发生":"已发生");
        $("#dbzflj").html('¥' + AccountInfo.dbzflj);
        $("#dbbz").html(AccountInfo.zdjbbz=="0"?"未发生":"已发生");
        $("#ywshzflj").html('¥' + AccountInfo.ywshzflj);
        $("#ndyjhzflj").html('¥' + AccountInfo.ndyjhzflj);
        $("#etlbzflj").html('¥' + AccountInfo.etlbzflj);
        $("#khxmzflj").html('¥' + AccountInfo.kfxmzflj);
        $("#mzzyzfje").html('¥' + AccountInfo.mzzyzflj);
        $("#mzmzzfje").html('¥' + AccountInfo.mzmzzflj);
        $("#jxbzje").html('¥' + AccountInfo.jxbzlj);
        $("#mztcljje").html('¥' + AccountInfo.ptmztclj);
        $("#yddjbs").html(ydbs(AccountInfo.yddjbz));
        $("#zhxxyl1").html(AccountInfo.yl1);
        $("#zhxxyl2").html(AccountInfo.yl2);
    }

    function fszk(key) {
        var fszk = {
            '10': '待遇审核期', '11': '个体参保待遇审核期', '15': '基本转个体待遇审核', '16': '个体转基本待遇审核', '20': '欠费封锁', '21': '基本医疗欠费', '23': '大额医疗欠费', '29': '住院医疗欠费'
            , '30': '停保', '40': '退保', '45': '暂停待遇享受', '50': 'IC 卡挂失', '51': 'IC 卡注销', '52': '假卡', '90': '其他'
        };
        return fszk[key];
    }

    function rybglx(key) {
        var rybglx = {
            '11': '新参保', '12': '续保', '13': '统筹范围外转入', '14': '统筹内本区转入', '15': '退休转在职', '16': '统筹内跨区转入', '19': '退保恢复', '21': '退保', '22': '停保', '23': '转出统筹范围外', '24': '统筹内本区转出', '25': '在职转退休', '26': '统筹内跨区转出', '30': '修改参保时间'
            , '44': '暂停待遇享受', '45': '恢复待遇享受', '46': '参加农民工医疗保险', '47': '农民工转非农民工', '99': '其他'
        };
        return rybglx[key];
    }
    function mzrylb(key)
    {
        var mzrylb = {
            '1': '城乡低保对象', '2': '城市三无人员', '3': '农村五保对象', '4': '城乡孤儿', '5': '在乡重点优抚对象(不含1-6级残疾军人)', '6': '城乡重度(一、二级)残疾人员', '7': '民政部门建档其他人员', '8': '家庭经济困难大学生', '9': '在乡老复原军人'
            , '10': '优抚六十岁以上老兵', '11': '因病致贫家庭重病患者', '12': '建卡贫困户', '13': '特困人员'
        };
        return mzrylb[key];
    }

    function ydbs(key) {
        var ydbs = { '0': '未登记异地', '1': '区内二级以上医院就诊', '2': '长期驻外', '3': '区外急诊', '4': '区内转诊', '5': '区外转诊' };
        return ydbs[key];
    }
</script>
